package com.gip.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Order {
    private int id;
    private int customerId;
    //前端页面转换到Date字段,用来接收前端传递的字符串类型的时间,自动转换为Date类型(用Date类型的实体接受)
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    //出参格式,返回给前端的时间格式,加入timezone防止出现时间差
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    //转换为jsonObject返回的时候就正常了,不会返回时间戳.
    @JSONField(format = "yyyy-MM-dd")
    private Date payDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @JSONField(format = "yyyy-MM-dd")
    private Date maturityDate;
    private double cost;
    private int payType;
    private int userId;
    //补充字段，DTO
    private String payName;
    private String processingType;
    private String name;
    private Integer payTime;
}
